package com.qingke.hibernate.bean;

import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

@Entity
@Table(name="teacher")
//@Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
public class Teacher {
	@Id
	@Column(name="id")
	private int id;
	
	@Column(name="firstname")
	private String firstname;
	
	@Column(name="lastname")
	private String lastname;
	
	@Column(name="phone")
	private String phone;
	
	@Column(name="email")
	private String email;
	
	@Column(name="gender")
	private String gender;
	
	@Column(name="age")
	private int age;
	
	@OneToMany(mappedBy="teacher")
	private Set<CourseSet> courseSets;
	
//	@ManyToMany
//	@JoinTable(name="teachers_students",
//	joinColumns=@JoinColumn(name="teacher_id"),
//	inverseJoinColumns=@JoinColumn(name="student_id"))
//	private Set<Student> students;
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getFirstname() {
		return firstname;
	}
	public void setFirstname(String firstname) {
		this.firstname = firstname;
	}
	public String getLastname() {
		return lastname;
	}
	public void setLastname(String lastname) {
		this.lastname = lastname;
	}
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getGender() {
		return gender;
	}
	public void setGender(String gender) {
		this.gender = gender;
	}
	public int getAge() {
		return age;
	}
	public void setAge(int age) {
		this.age = age;
	}
//	public Set<Student> getStudents() {
//		return students;
//	}
//	public void setStudents(Set<Student> students) {
//		this.students = students;
//	}
	
	public Set<CourseSet> getCourseSets() {
		return courseSets;
	}
	public void setCourseSets(Set<CourseSet> courseSets) {
		this.courseSets = courseSets;
	}
	@Override
	public String toString() {
		return "Teacher [id=" + id + ", firstname=" + firstname + ", lastname=" + lastname + ", phone=" + phone
				+ ", email=" + email + ", gender=" + gender + ", age=" + age + "]";
	}
	
}
